package com.lzq.messagewall.service;

import com.lzq.messagewall.mapper.MessageInfoXmlMapper;
import com.lzq.messagewall.model.MessageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class MessageService {
    private List<MessageInfo> messageInfoList = new ArrayList<>();
    @Autowired
    private MessageInfoXmlMapper mapper;
    public boolean publishService(MessageInfo messageInfo) {
        if(messageInfo!=null) {
            mapper.insert(messageInfo);
            messageInfoList.add(messageInfo);
            return true;
        }
        return false;
    }

    public List<MessageInfo> getListService() {
        return messageInfoList;
    }
}
